home *** CD-ROM | disk | FTP | other *** search
- > As a substitute for select...case I don't think either is good. They're
- > both messy. Try this instead:
- > If AGE<10
- > Print "You are less than 10 years old."
- > else if AGE=21
- > Print "Hey!! Now you can drink alcohol in the U.S.!!"
- > else
- > Print "WOW, you're OVER 21!!"
- > endif
- > Smallest, and tidiest in my humble opinion.
- > Is my approach good enough in the meantime?
-
- Well, problem is this won't work. First, you need to match every
- If with an End If and second, the logic is not the same. To write
- it in the above style, so it will work in AMOS while retaining the
- original logic, you'd need to do something like this:
- If AGE<10
- Print "You are less than 10 years old."
- Else If AGE=21
- Print"Hey!! Now you can drink alcohol in the U.S.!!"
- Else If AGE>21
- Print "WOW, you'r OVER 21!!"
- End If
- End If
- End If
-
- That being said, this might be a bit clearer (arguably the "best"
- method for AMOS) but it still lacks when compared to the
- Select...Case style. Anyway, the point is you are still looking at
- the same two basic methods, the If...End If and the If...Else...EndIf
-
-
- > Hey, even old GFA-BASIC had select...case. It's quite handy at
- > times since you could have like this for instance...
-
- You don't have to convince me, I agree with you (I'm a bit of a
- nut for "clean" code). If there's enough interest, when Pietro has
- everything sorted out, perhaps he'll implement Select...Case in
- AMOS version 3.0 :-)
-
-
- Garfield Benjamin e-mail:gbenjam@sosbbs.com
- Website( http://www.sosbbs.com/~gbenjam ): 50% Complete
-
-